<?= isset($header) ? $header : '' ?>
<div id="content">
    <div style="overflow:visible;" class="form_style">
        <div class="title">
            <h5>市調－公司－資料查询</h5>
        </div>
        <!--

        -->
        <form  	method="POST"
                action="<?= site_url('/MarketResearch/market/company_data_query_results') ?>"
                id="userinfo">

            <table>
                <tbody>
                    <tr>
                        <th>顧客</th>
                        <td>
                            <input type="text"  name="owner" id="owner">

                        </td>

                        <th>售租案</th>
                        <td>
                            <input type="checkbox" value="1" id="type_rent" name="type_rent">租賃
                            <input type="checkbox" value="2" id="type_sale" name="type_sale">買賣
                            <!--
                            <input type="checkbox" value="3" id="type_help_seal" name="type_help_seal">租售案
                            -->
                        </td>
                    </tr>

                    <tr>
                        <th>建物門牌</th>
                        <td>
                            行政區&nbsp;
                            <input type="text"
                                   id="administrative_area"
                                   name="administrative_area"
                                   onclick="show_administrative_area('administrative_area');" style="width:120px;">&nbsp;

                            <input type="text"
                                   style="width:60%;"
                                   id="house_building"
                                   name="house_building"
                                   onclick="show_hous_ebuilding('house_building');">

                        </td>
                        <th>區域</th>
                        <td>
                            <input type="text"  name="area" id="area" onclick="show_emphasis_area('area')">
                        </td>
                    </tr>


                    <tr>
                        <th>物件案名</th>
                        <td>
                            <select class="full_select" style="width:200px;" name="case_name" id="case_name">
                                <option value="">&nbsp;</option>
                                <?php
                                foreach($object_names as $key=>$val){
                                ?>
                                <option value="<?= $val->value ?>"><?= $val->value ?></option>
                                <?
                                }
                                ?>
                            </select>
                        </td>
                        <th>大樓名稱</th>
                        <td>
                            <select class="full_select" style="width:200px;" name="building_name" id="building_name">
                                <option value="">&nbsp;</option>
                                <?
                                foreach($building_name as $key=>$val){
                                ?>
                                <option value="<?= $val->value ?>"><?= $val->value ?></option>
                                <?
                                }
                                ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>物件用途</th>
                        <td>
                            <select class="full_select" style="width:200px;" name="object_usage" id="object_usage">
                                <option value="">&nbsp;</option>
                                <?
                                foreach($object_usage as $key=>$val){
                                ?>
                                <option value="<?= $val->object_usage_id ?>"><?= $val->value ?></option>
                                <?
                                }
                                ?>
                            </select>
                        </td>
                        <th>物件狀態</th>
                        <td>
                            <select class="full_select" style="width:200px;" name="object_state" id="object_state">
                                <option value="">&nbsp;</option>
                                <?
                                foreach($object_state as $key=>$val){
                                ?>
                                <option value="<?= $val->object_state_id ?>"><?= $val->value ?></option>
                                <?
                                }
                                ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>建物面積</th>
                        <td><input type="text" name="building_area1" id="building_area1"> ~ <input type="text" name="building_area2" id="building_area2">坪</td>
                        <th>土地面積</th>
                        <td><input type="text" name="base_area1" id="base_area1">~<input type="text" name="base_area2" id="base_area2">坪</td>
                    </tr>
                    <tr>
                        <th>總價</th>
                        <td><input type="text" name="total1" id="total1"> ~ <input type="text" name="total2" id="total2">萬</td>
                        <th>範圍<br>
                            <input type="button" value="設定" onclick="show_range_map();" class="input_background">
                        </th>
                        <td>緯度 <input type="text" name="latitude1" id="latitude1"> ~ <input type="text" name="latitude2" id="latitude2"><br>
                            經度 <input type="text" name="longitude1" id="longitude"> ~ <input type="text" name="longitude2" id="longitude2">
                        </td>
                    </tr>
                    <tr>
                        <th>物件案別</th>
                        <td><input type="checkbox" value="1" name="object_case_type[]">中古屋 &nbsp;&nbsp;
                            <input type="checkbox" value="2" name="object_case_type[]">預售 &nbsp;&nbsp;
                            <input type="checkbox" value="3" name="object_case_type[]">標售</td>
                        <th>屋齡</th>
                        <td><input type="text" name="year_of_construction1" id="year_of_construction1">年~<input type="text" name="year_of_construction2" id="year_of_construction2">年</td>
                    </tr>
                    <tr>
                        <th>經紀人</th>
                        <td colspan="3">

                        	<select name="broker" id="broker">
				    		<option></option>
					    	<?php
					    	foreach($borkers as $broker):
								echo '<option value="'.$broker->users_id.'">'.$broker->name.'</option>';
						endforeach;
					    	?>
					    	</select>


                        </td>
                    </tr>


                    <tr style="display:none;">
                        <th>委託起日</th>
                        <td><input type="text" class="Wdate" style="width:100px;"  onclick="WdatePicker()" name="entrust_start1" id="entrust_start1"> ~ <input type="text" class="Wdate" onclick="WdatePicker()" style="width:100px;" name="entrust_start2" id="entrust_start2"></td>
                        <th>委託迄日</th>
                        <td><input type="text" class="Wdate" onclick="WdatePicker()" style="width:100px;" name="entrust_end1"  id="entrust_end1"> ~ <input type="text" class="Wdate" onclick="WdatePicker()" style="width:100px;" name="entrust_end2" id="entrust_end2"></td>
                    </tr>


                    <tr>
                        <th>排序</th>
                        <td>
                            <select class="full_select" style="width:100px;" name="orderby" id="orderby">
                                <option value="ctime">建檔日期</option>
                            </select>
                            &nbsp;
                            <select class="full_select" style="width:100px;" name="sort"  id="sort">
                                <option value="desc">降冪排列</option>
                                <option value="asc">升冪排列</option>
                            </select>
                        </td>
                        <th>密件</th>
                        <td><input type="radio" value="N" name="bcc" id="bcc">否
                            <input type="radio" value="Y" name="bcc" id="bcc">是
                        </td>
                    </tr>

                    <tr>
                        <th>物件編號</th>
                        <td><input type="text"  name="object_no" id="object_no"></td>
                        <th>所在樓層</th>
                        <td><input type="text"  name="floor1" id="floor1"> ~
                            <input type="text"  name="floor2" id="floor2">
                        </td>
                    </tr>

                    <tr>
                        <th>關鍵字</th>
                        <td><input type="text" name="keywords" id="keywords"></td>
                        <th>建檔日期</th>
                        <td><input type="text" class="Wdate" style="width:100px;" onclick="WdatePicker()" name="sctime" id="sctime"> ~ <input type="text" class="Wdate" style="width:100px;" onclick="WdatePicker()" name="ectime" id="ectime"></td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td colspan="3">
                            <input type="submit" value="查詢確認" class="input_background">
                        </td>
                    </tr>
                </tbody></table>
        </form>
    </div>




    <div id="administrative_area_select" style="display: none;">

        <div id="city_div"  style="float:left;padding:10px">
            <h3>縣市</h3>
            <select onchange="administrative_area_city_choose();" style="width:102px;" size="30" id="administrative_city">
                <option value="">請選擇</option>
                <?
                foreach($address_city as $key=>$val){
                ?>
                <option value="<?= $val->id ?>"><?= $val->name ?></option>
                <?
                }
                ?>
            </select>
        </div>

        <div id="area_div"  style="float:left;padding:10px;width:102px;">
            <h3>區域</h3>
            <select onchange="administrative_area_choose();" style="width:102px;" size="30" id="administrative_country">
                <option value="">請選擇</option>
            </select>
        </div>
        <div style="clear: both;"></div>
        <div id="addr_div" style="padding:10px">
            <input type="text" value="" id="administrative_area_value" >
        </div>

    </div>


    <div id="emphasis_area_select" style="display: none;"  class="form_style">
        <table class="windows_choose">
            <thead>
                <tr>
                    <th>選擇</th>
                    <th>重點區域</th>
                    <th>說明</th>

                </tr>
            </thead>
            <tbody>
                <?
                foreach($emphasis_area as $key=>$val){
                ?>
                <tr id="t_<?= $val->emphasis_area_id ?>">
                    <td><input type="radio" value="<?= $val->value ?>" name="emphasis_area_value" id="emphasis_area_value"></td>
                    <td><?= $val->value ?></td>
                    <td><?= $val->explanation ?></td>
                </tr>
                <?
                }
                ?>
            </tbody>
        </table>
    </div>


    <div id="hous_ebuilding_select" style="display: none;">
        <div id="area_div"  style="float:left;padding:10px;width:102px;display: none;">
            <h3>行政區</h3>

            <select name="hous_ebuilding_administrative_area"
                    id="hous_ebuilding_administrative_area"
                    style="width:102px;" size="20"
                    onchange="hous_ebuilding_administrative_area_choose();">

                <option value="">請選擇</option>
                <?
                foreach($administrative_area as $key=>$val){
                ?>
                <option value="<?= $val->id ?>"><?= $val->name ?></option>
                <?
                }
                ?>
            </select>
        </div>

        <div id="street_div" style="float:left;padding:10px">
            <h3>街道</h3>
            <select onchange="hous_ebuilding_street_choose()" style="width:102px;" size="20" id="hous_ebuilding_street">
                <option value="">請選擇</option>
            </select>
        </div>

        <div id="other_div" style="float:left;padding:10px">
            <h3>其它</h3>

            <div>
                <input type="button" onclick="hous_ebuilding_word_choose('thousand')" value="千" class="button" name="thousand" id="thousand">
                <input type="button" onclick="hous_ebuilding_word_choose('village')" value="村" class="button" name="village" id="village">
                <input type="button" onclick="hous_ebuilding_word_choose('in')" value="里" class="button" name="in" id="in">
                <input type="button" onclick="hous_ebuilding_word_choose('neighbor')" value="鄰" class="button" name="neighbor" id="neighbor">
            </div>

            <div>
                <input type="button" onclick="hous_ebuilding_word_choose('road')" value="路" class="button" name="road" id="road">
                <input type="button" onclick="hous_ebuilding_word_choose('word_street')" value="街" class="button" name="word_street" id="word_street">
                <input type="button" onclick="hous_ebuilding_word_choose('paragraph')" value="段" class="button" name="paragraph" id="paragraph">
                <input type="button" onclick="hous_ebuilding_word_choose('lane')" value="巷" class="button" name="lane" id="lane">
            </div>

            <div>
                <input type="button" onclick="hous_ebuilding_word_choose('get')" value="弄" class="button" name="get" id="get">
                <input type="button" onclick="hous_ebuilding_word_choose('number')" value="號" class="button" name="number" id="number">
                <input type="button" onclick="hous_ebuilding_word_choose('floor')" value="樓" class="button" name="floor" id="floor">
                <input type="button" onclick="hous_ebuilding_word_choose('room')" value="室" class="button" name="room" id="room">
            </div>

            <div>
                <input type="button" onclick="hous_ebuilding_word_choose('the')" value="之" class="button" name="the" id="the">
                <input type="button" onclick="hous_ebuilding_word_choose('del')" value="Del" class="button" name="del" id="del">
            </div>
            <div>
                <input type="button" onclick="hous_ebuilding_word_choose('number_1')" value="1" class="button" name="number_1" id="number_1">
                <input type="button" onclick="hous_ebuilding_word_choose('number_2')" value="2" class="button" name="number_2" id="number_2">
                <input type="button" onclick="hous_ebuilding_word_choose('number_3')" value="3" class="button" name="number_3" id="number_3">
                <input type="button" onclick="hous_ebuilding_word_choose('number_4')" value="4" class="button" name="number_4" id="number_4">
                <input type="button" onclick="hous_ebuilding_word_choose('number_5')" value="5" class="button" name="number_5" id="number_5">
            </div>
            <div>
                <input type="button" onclick="hous_ebuilding_word_choose('number_6')" value="6" class="button" name="number_6" id="number_6">
                <input type="button" onclick="hous_ebuilding_word_choose('number_7')" value="7" class="button" name="number_7" id="number_7">
                <input type="button" onclick="hous_ebuilding_word_choose('number_8')" value="8" class="button" name="number_8" id="number_8">
                <input type="button" onclick="hous_ebuilding_word_choose('number_9')" value="9" class="button" name="number_9" id="number_9">
                <input type="button" onclick="hous_ebuilding_word_choose('number_0')" value="0" class="button" name="number_0" id="number_0">
            </div>
        </div>
        <div style="clear: both;"></div>
        <div id="addr_div" style="padding:10px">
            <input type="text" value="" id="hous_ebuilding_address" style="width:400px;">
        </div>

    </div>




    <div id="range_map_select" style="display: none;" >
        <div id="mycontrol" style="z-index: 0; position: absolute; top: 0px; left: 346px;"><div id="start">開始選取</div><div id="end">結束選取</div></div>
        <div id="map_canvas" style="width:620px;height:600px"></div>
        <div>
            (東北)纬度：<input type="text" id="_latitude1">经度：<input type="text" id="_longitude1"><br>
            (西南)纬度：<input type="text" id="_latitude2">经度：<input type="text" id="_longitude2"><br>
            <span style="color:red;">選取過程中，點擊所選區域以確定基本選區,選區大小可修改，選區可拖動(注：默認顯示台北市)</span>
        </div>
    </div>
    <?=
    isset($footer) ? $footer : ''?>
